<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>模态框</title>
</head>
<style>
    .wrap {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.5);
        /* opacity: 0.5; */
    }
    .form {
        width: 200px;
        height: 200px;
        background-color: brown;
        position: absolute;
        /* top: 0;
        left: 0;
        right: 0;
        bottom: 0; */
        /* margin: auto; */
        top: 50%;
        left: 50%;
        margin-left: -100px;
        margin-top: -100px;
    }
</style>
<body>
    <div class="wrap">
        <div class="form">
            <label for="">姓名</label><input type="text">
        </div>
    </div>
</body>
</html>